﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

public partial class ListRequest : System.Web.UI.Page
{
    SqlConnection conn = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Employee"] == null)
        {
            Response.Redirect("~/Login.aspx");
        }
        else
        {
            conn = Database.GetConnection();
            GetListRequest();
        }
    }
    public void GetListRequest()
    {
        DataTable dtemployee = (DataTable) Session["Employee"];
        string idemployee = dtemployee.Rows[0][0].ToString();
        SqlDataAdapter adapter = new SqlDataAdapter("select Request.R_ID, Employees.Emp_Username, Request.R_Date,Request.R_Status,Request.R_Price from Request inner join Employees on Request.[to] = Employees.Emp_ID where [from] = "+idemployee+"", conn);
        DataTable dt = new DataTable();
        adapter.Fill(dt);
        gvListRequest.DataSource = dt;
        gvListRequest.DataBind();
    }
}